/*
 * @(#)Role.java
 * 
 * Create Version: 1.0.0
 * Author: James Liu
 * Create Date: 2009-12-09
 * 
 * Copyright (c) 2009 ASPire Information Technologies Ltd. All Right Reserved.
 */
package com.aspire.boc.mms.wmf.cam;


import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;


/**
 * CAM value object.
 * 
 * @version 1.0.0   2009-12-09
 * @author  James Liu
 */
public class Role implements Serializable {
    
    private static final long serialVersionUID = 4871524567283667321L;
    
    private int id;
    private String name;
    private String desc;
    private String systemDef;
    
    private Set<User> users = new LinkedHashSet<User>();
    private Set<Group> groups = new LinkedHashSet<Group>();
    
    
    public int getId() {
    
        return id;
    }
    
    public void setId(int id) {
    
        this.id = id;
    }
    
    public String getName() {
    
        return name;
    }
    
    public void setName(String name) {
    
        this.name = name;
    }
    
    public String getDesc() {
    
        return desc;
    }
    
    public void setDesc(String desc) {
    
        this.desc = desc;
    }
    
    public String getSystemDef() {
    
        return systemDef;
    }
    
    public void setSystemDef(String systemDef) {
    
        this.systemDef = systemDef;
    }
    
    public Set<User> getUsers() {
    
        return users;
    }
    
    public void setUsers(Set<User> users) {
    
        this.users = users;
    }
    
    public Set<Group> getGroups() {
    
        return groups;
    }
    
    public void setGroups(Set<Group> groups) {
    
        this.groups = groups;
    }
    
    public String toString() {
        
        StringBuilder result = new StringBuilder();
        
        result.append("Role[id=")
              .append(this.getId())
              .append(", name=")
              .append(this.getName())
              .append(", desc=")
              .append(this.getDesc())
              .append(", systemDef=")
              .append(this.getSystemDef())
              .append(", userCount=")
              .append(this.getUsers().size())
              .append(", groupCount=")
              .append(this.getGroups().size())
              .append("]");
        
        return result.toString();
    }
}